package vendas.dao;

import gminet.infra.dao.Filter;
import gminet.infra.toolkit.StringToolkit;

import java.util.Date;

import vendas.dto.OrderStatus;
import vendas.dto.PaymentStatus;
import vendas.dto.Product;
import vendas.dto.SellStatus;
import vendas.dto.Seller;
import vendas.dto.User;

public class OrderFilter extends Filter {

    private static final long serialVersionUID = 1L;

    private User user;
    private Seller seller;
    private Product product;
    private OrderStatus orderStatus;
    private boolean noOrderStatus = false;
    private PaymentStatus paymentStatus;
    private SellStatus sellStatus;
    private Date buyDate;
    private String sellerOrderId;

    public OrderFilter() {
        super();
    }

    public boolean hasUser() {
        return getUser() != null && getUser().getId() > 0;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public boolean hasSeller() {
        return getSeller() != null && getSeller().getId() > 0;
    }

    public Seller getSeller() {
        return seller;
    }

    public void setSeller(Seller seller) {
        this.seller = seller;
    }

    public boolean hasProduct() {
        return getProduct() != null && getProduct().getId() > 0;
    }

    public Product getProduct() {
        return product;
    }

    public void setProduct(Product product) {
        this.product = product;
    }

    public OrderStatus getOrderStatus() {
        return orderStatus;
    }

    public boolean hasOrderStatus() {
        return getOrderStatus() != null && !getOrderStatus().equals(OrderStatus.UNDEFINED);
    }

    public void setOrderStatus(OrderStatus orderStatus) {
        this.orderStatus = orderStatus;
    }

    public boolean getNoOrderStatus() {
        return noOrderStatus;
    }

    public void setNoOrderStatus(boolean noOrderStatus) {
        this.noOrderStatus = noOrderStatus;
    }

    public PaymentStatus getPaymentStatus() {
        return paymentStatus;
    }

    public boolean hasPaymentStatus() {
        return getPaymentStatus() != null && !getPaymentStatus().equals(PaymentStatus.UNDEFINED);
    }

    public void setPaymentStatus(PaymentStatus paymentStatus) {
        this.paymentStatus = paymentStatus;
    }

    public SellStatus getSellStatus() {
        return sellStatus;
    }

    public boolean hasSellStatus() {
        return getSellStatus() != null && !getSellStatus().equals(SellStatus.UNDEFINED);
    }

    public void setSellStatus(SellStatus sellStatus) {
        this.sellStatus = sellStatus;
    }

    public boolean hasBuyDate() {
        return getBuyDate() != null;
    }

    public Date getBuyDate() {
        return buyDate;
    }

    public void setBuyDate(Date buyDate) {
        this.buyDate = buyDate;
    }

    public boolean hasSellerOrderId() {
        return StringToolkit.isFill(getSellerOrderId());
    }

    public String getSellerOrderId() {
        return sellerOrderId;
    }

    public void setSellerOrderId(String sellerOrderId) {
        this.sellerOrderId = sellerOrderId;
    }

}
